//
//  MCMathUnits.h
//  TLYL
//
//  Created by miaocai on 2017/6/2.
//  Copyright © 2017年 TLYL01. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "MCPaySelectedLotteryModel.h"
#define MC_MAXCOUNT 170

/**n的阶乘*/
#define MC_FACTORIAL(N) \
({\
int temp = N;\
if(N<0){\
temp = 0;\
}\
double result = 1;\
for (int i = 1; i<=temp; i++) {\
result = result * i;\
}\
(result);\
})\

/**n的和*/
#define MC_SUM(N)\
({\
if (N > MC_MAXCOUNT) {\
NSLog(@"数字溢出");\
}\
double result = 0;\
for (int i = 1; i<=N; i++) {\
result = result + i;\
}\
(result);\
})\

/**n到m的乘积n<m*/
#define MC_DIFFERENT(N,M)\
({\
if (M > MC_MAXCOUNT) {\
NSLog(@"数字溢出");\
}\
(MC_FACTORIAL(M)/MC_FACTORIAL(N-1));\
})\

/**n到m的排列n<m*/
#define MC_ACOMBINATION(M,N)\
({\
if (M > MC_MAXCOUNT) {\
NSLog(@"数字溢出");\
}\
(MC_FACTORIAL(M)/MC_FACTORIAL(M-N));\
})\

/**n到m的组合n<m*/
#define MC_CCOMBINATION(M,N)\
({\
if (M > MC_MAXCOUNT) {\
NSLog(@"数字溢出");\
}\
(MC_FACTORIAL(M)/(MC_FACTORIAL((M)-(N))*MC_FACTORIAL(N)));\
})\
/**随机*/
#define MC_RANDOM 0

@interface MCMathUnits : NSObject

/*
 * 根据玩法Model 获取标准格式
 */
+(MCPaySelectedCellModel *)GetFormatWithWFModel:(MCBasePWFModel *)WFmodel;
@end
